/*
 * Contact.java
 *
 * Creada el 27/01/2012, 02:09:23 PM
 *
 * Clase Java desarrollada por Edgar Ramos para 7i Software Factory el día 27/01/2012
 *
 * Para informacion sobre el uso de esta clase, asi como bugs, actualizaciones, o mejoras enviar un mail a
 * eramos@7i.com.mx
 *
 * Desarrollado por la célula de desarrollo de Zacatecas
 *
 */
package com.grupoquark.cic.model.contact;

import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import org.apache.log4j.Logger;

/**
 * @author Edgar Ramos
 * @version 1.0
 * @author-mail eramos@7i.com.mx @date 27/01/2012
 */
@Entity
@Table(name = "contacts")
public class Contact implements Serializable
{
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private long id;
    private String address;
    private String telephone;
    private String others;
    //Other variables and constants
    private static transient final Logger LOG = Logger.getLogger(Contact.class);

    protected Contact()
    {

        if (LOG.isTraceEnabled())
        {
            LOG.trace("Empty Contact created;");
        }
    }

    public Contact(String telephone)
    {

        this.telephone = telephone;
        if (LOG.isTraceEnabled())
        {
            LOG.trace("Contact created: " + telephone);
        }
    }

    public String getAddress()
    {
        return address;
    }

    public void setAddress(String address)
    {
        this.address = address;
    }

    public String getOthers()
    {
        return others;
    }

    public void setOthers(String others)
    {
        this.others = others;
    }

    public String getTelephone()
    {
        return telephone;
    }

    public void setTelephone(String telephone)
    {
        this.telephone = telephone;
    }

    public long getId()
    {
        return id;
    }

    protected void setId(long id)
    {
        this.id = id;
    }

    @Override
    public String toString()
    {
        return "Contact{" + "id=" + id + ", address=" + address + ", telephone=" + telephone + ", others=" + others + '}';
    }

    @Override
    public boolean equals(Object obj)
    {
        if (obj == null)
        {
            return false;
        }
        if (getClass() != obj.getClass())
        {
            return false;
        }
        final Contact other = (Contact) obj;
        if (this.id != other.id)
        {
            return false;
        }
        if ((this.address == null) ? (other.address != null) : !this.address.equals(other.address))
        {
            return false;
        }
        if ((this.telephone == null) ? (other.telephone != null) : !this.telephone.equals(other.telephone))
        {
            return false;
        }
        if ((this.others == null) ? (other.others != null) : !this.others.equals(other.others))
        {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode()
    {
        int hash = 7;
        hash = 79 * hash + (int) (this.id ^ (this.id >>> 32));
        hash = 79 * hash + (this.address != null ? this.address.hashCode() : 0);
        hash = 79 * hash + (this.telephone != null ? this.telephone.hashCode() : 0);
        hash = 79 * hash + (this.others != null ? this.others.hashCode() : 0);
        return hash;
    }
}
